(require :rtmeus (format nil "~A/eus/common/rtmeus.l" (unix:getenv 'RTMEUSDIR)))
;;
(setq *rtm* (instance RTMeus :init "localhost"))
;;load module
(send *rtm* :load-module (format nil "~A/RTMEus/~A/lib/UsbCameraAcquire.so" (unix:getenv 'RTMEUSDIR) (unix:getenv "ARCHDIR")) "UsbCameraAcquireInit")
(send *rtm* :load-module (format nil "~A/RTMEus/~A/lib/UsbCameraMonitor.so" (unix:getenv 'RTMEUSDIR) (unix:getenv "ARCHDIR")) "UsbCameraMonitorInit")
(send *rtm* :load-module (format nil "~A/RTMEus/~A/lib/Flip.so" (unix:getenv 'RTMEUSDIR) (unix:getenv "ARCHDIR")) "FlipInit")
;;create component
(setq acq (send *rtm* :create-component "UsbCameraAcquire" "UsbCameraAcquire0" :execrate 30 :with-outstate nil))
(setq flip (send *rtm* :create-component "Flip" "Flip0" :execrate 30 :with-outstate nil))
(setq mon0 (send *rtm* :create-component "UsbCameraMonitor" "UsbCameraMonitor0" :execrate 30 :with-outstate nil))
(setq mon1 (send *rtm* :create-component "UsbCameraMonitor" "UsbCameraMonitor1" :execrate 30 :with-outstate nil))
;;connect components
(send *rtm* :connect-components acq "imageout" flip "originalImage")
(send *rtm* :connect-components acq "imageout" mon0 "ImageData")
(send *rtm* :connect-components flip "flippedImage" mon1 "ImageData")
;;plugin-mode
(send *rtm* :set-master-comp acq)
(send *rtm* :add-slave-comp flip)
(send *rtm* :add-slave-comp mon0)
(send *rtm* :add-slave-comp mon1)
(send *rtm* :set-plugin-mode)
;;activate all components
(send *rtm* :all-activate)
;;(send *rtm* :exit)